/**
 * getUrlKey 截取地址栏参数
 * @param value
 * @returns {String}
 */
function getUrlKey(name) {
	return (
		decodeURIComponent(
			(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(
				/\+/g,
				'%20'
			)
		) || null
	)
}
/**
 * 格式化下拉对象
 * */

function mapDropDown(arr) {
	console.log(arr, 'arr')
	if (arr.length !== 0) {
		let newArr = arr.map(item => {
			let as = {
				value: item.id,
				label: item.text
			}
			return as
		})
		console.log(newArr)
		return newArr
	} else {
		return []
	}
}
export default {
	getUrlKey,
	mapDropDown
}
